import Vue from 'vue'
import * as http from './http'

function Api() {
  let api = new Object()
  api.user = {
    login: (data) => {
      let requestParams = {json: data}
      requestParams['rmstoken'] = '127.0.0.1'
      return http.post('/api/engineer/login.do', requestParams)
    }
  }
  return api
}


function Engineer() {
  let object = new Object()
  // 查询工程登录单
  object.searchStartOrder = (data) => {
    return http.api('app.engineer.searchStartOrder', data)
  }
  // 查询工程合同
  object.searchEngineerContract = (data) => {
    return http.api('app.engineer.searchEngineerContract', data)
  }
  // 查询要货单
  object.searchNeedGoods = (data) => {
    return http.api('app.engineer.searchNeedGoods', data)
  }
  // 获取工程用途
  object.getGCYT = (data = {}) => {
    data['sqlid'] = 'PUBCX.XLK'
    return http.select(data)
  }
  // 获取工程跟踪人
  object.getGCGZR = (data = {}) => {
    data['sqlid'] = 'RYXX.GCGZR'
    data['QryType'] = 'Report'
    return http.select(data)
  }
  // 获取工程商品列表
  object.getGCSP_SPXX = (data = {}) => {
    data['sqlid'] = 'SPXX.GCSP_SPXX'
    data['QryType'] = 'Report'
    data['GCSFDL'] = '0'
    return http.select(data)
  }
  // 工程登录单制单接口
  object.startOrderSave = (data = {}) => {
    return http.api('app.engineer.startOrderSave', data)
  }

  // 工程合同制单接口
  object.contractSave = (data = {}) => {
    return http.api('app.engineer.contractSave', data)
  }

  // 工程合同制单接口
  object.needGoodsSave = (data = {}) => {
    return http.api('app.engineer.needGoodsSave', data)
  }

  // 工程交资料制单接口
  object.startData = (data = {}) => {
    return http.api('app.engineer.startData', data)
  }

  //工程交资料首页 查询
  object.queryStartData = (data = {}) => {
    return http.api('app.engineer.queryStartData', data)
  }

  //工程登录单 保存草稿
  object.startDraft = (data = {}) => {
    return http.api('app.engineer.startDraft', data)
  }

  //获取密码
  object.searchPassword = (data) => {
    return http.api('app.engineer.searchPassword', data)
  }

  object.searchMydata = (data) => {
    return http.api('app.engineer.searchMydata', data)
  }

  object.searchSurplusList = (data) => {
    return http.api('app.engineer.searchSurplusList', data)
  }

  object.searchDrafts = (data) => {
    return http.api('app.engineer.searchDrafts', data)
  }

  object.delDrafts = (data) => {
    return http.api('app.engineer.delDrafts', data)
  }

  object.searchMyStart = (data) => {
    return http.api('app.engineer.searchMyStart', data)
  }

  object.searchMyContract = (data) => {
    return http.api('app.engineer.searchMyContract', data)
  }

  object.searchMyNeed = (data) => {
    return http.api('app.engineer.searchMyNeed', data)
  }

  object.searchMyInformation = (data) => {
    return http.api('app.engineer.searchMyInformation', data)
  }

  object.searchCustomerNeed = (data) => {
    return http.api('app.engineer.searchCustomerNeed', data)
  }

  object.searchCustomerNeedJxs = (data = {}) => {
    data['sqlid'] = 'KHYHD.KHYHD_JXS'
    return http.select(data)
  }

  //客户要货单查询经销商明细
  object.searchJxsmx = (data = {}) => {
    data['sqlid'] = 'WLDW.DWYEZ'
    return http.select(data)
  }

  object.searchCustomerNeedXsfs = (data = {}) => {
    data['sqlid'] = 'FLFS.FLFSXX'
    return http.select(data)
  }

  object.searchCustomerNeedGoods = (data = {}) => {
    return http.api('jl.scm.fxgl.yhd.GetSPJG_KHYHD.getSPJG', data)
  }

  object.searchCustomerNeedKHYHBJ = (data = {}) => {
    data['sqlid'] = 'FLFS.XSFS'
    return http.select(data)
  }

  object.searchCustomerNeedCyf = (data = {}) => {
    data['sqlid'] = 'ZCD.CXCYF'
    return http.select(data)
  }

  object.customerNeedSave = (data = {}) => {
    return http.api('app.engineer.customerNeedSave', data)
  }

  object.searchNeedGood = (data = {}) => {
    data['sqlid'] = 'GCYHD.hotGCYHD';
    return http.select(data)
  }

  object.searchNeedBalance = (data = {}) => {
    data['sqlid'] = 'WLDW.DWYEZ';
    return http.select(data)
  }
  return object
}

Vue.prototype.$api = new Api()
Vue.prototype.$engineer = new Engineer()
